package com.feng.study.controller.circular;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 循环依赖
 * 1、@RequiredArgsConstructor(onConstructor = @__(@Autowired))启动报错循环依赖
 * 2、@Autowired不会报循环依赖的错误
 *
 * 全构造器注入 无法解决循环依赖
 * set注入，可以解决循环依赖
 *
 * 解决循环以来，三级缓存，set注入
 *
 * https://blog.csdn.net/Mrs_DongDong/article/details/127086281
 */
@Component
//@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class A {

        @Resource
//    @Autowired
    private B b;
}
